var app = {

    doVote : function (id) {
        $.ajax({
          type: "POST",
          url: Routing.generate('home_do_vote'),
          data: {id:id},
          success: this.successVote,
          dataType: 'json'
        });
    },

    redirectToStepThree: function () {
        window.location = Routing.generate('home_finish');
    },

    successVote : function (data, textStatus, jqXHR) {
        app.redirectToStepThree();
    }

};

$(function() {
    $("#acceptButton" ).on('click', function() {
        app.doVote($(this).attr('data-id'));
    });
});
